/**
 * Created by wangzilong on 2017/4/11.
 */
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    ScrollView,
    TouchableOpacity,
    TextInput,
    ListView,
    Modal,
    Platform
} from 'react-native';
import { NavigationActions } from 'react-navigation';
import ImageWrapper from '../components/ImageWrapper';
import NavigationBar from '../components/NavigationBar';
import JumpItem from '../components/JumpItem';
import SafeOfAccount from './SafeOfAccount';
import NewMessage from './NewMessage';
import guanyupeita from './guanyupeita';
import QuestionFeedback from './QuestionFeedback';
var Dimensions = require('Dimensions');
const { width, height } = Dimensions.get('window');

export default class SettingPage extends Component{
    constructor(props) {
        super(props);
        this.state = {
            
        };
        
    }
    render(){
        return (
            <View style={styles.container}>
                <NavigationBar 
                    leftIcon={'left'} 
                    titleText={'设置'}
                    leftPress={()=>this.goBack()}/>
                <ScrollView>
                    <View style={styles.infoBox}>
                        <JumpItem onPress={()=>this.goQuestionFeedback()} title={'问题反馈'} hasImg={true}/>
                    </View>
                    <View style={styles.infoBox}>
                        <JumpItem onPress={()=>this.goGuanyupeita()} title={'关于陪它'} hasImg={true} middleText={'V1.0.0'}/>
                    </View>
                    <View style={[styles.infoBox,{marginBottom:20}]}>
                        <TouchableOpacity onPress={()=>this.loginOut()}>
                            <View style={{flexDirection:'row',alignItems:'center',height:40,justifyContent:'center'}}>
                                <Text style={{fontSize:16,color:'#151515'}}>退出登录</Text>
                            </View>
                            
                        </TouchableOpacity>
                    </View>
                </ScrollView>
                
                
                
            </View>
        )

    }

    goBack(){
        this.props.navigation.goBack();
    }

    goNextPage(name,page){
        const {navigate } = this.props.navigation;
        navigate(name)
    }
    goGuanyupeita(){
        const {navigate } = this.props.navigation;
        navigate('guanyupeita')
    }
    goQuestionFeedback(){
        const {navigate } = this.props.navigation;
        navigate('QuestionFeedback')
    }

    loginOut(){
        const resetAction = NavigationActions.reset({
            index: 0,
            actions: [
                NavigationActions.navigate({ routeName: 'denglu'})
            ]
        })
        this.props.navigation.dispatch(resetAction)
    }
}

const styles = StyleSheet.create({
    container:{
        flex:1,
        backgroundColor:'#EFEFF4',
        ...Platform.select({
            ios: {
                marginTop: 20
            },
            android: {
                marginTop:0
            },

        }),
    }, 
    infoBox:{
        backgroundColor:'#fff',
        paddingLeft:10,
        borderTopWidth:1,
        borderTopColor:'#E4E4E6',
        borderBottomWidth:1,
        borderBottomColor:'#E4E4E6',
        marginTop:20
    },
    lineBorder:{
        borderBottomColor:'#E4E4E6',
        borderBottomWidth:1
    }
    
});